<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理系统_方维网络</title>
    <meta name="author" content="river" />
    <meta name="copyright" content="深圳方维网络科技有限公司 http://www.szfangwei.cn" />
    <meta name="version" content="V1.0" />
    <import type="css" file="admin/css/index" />
    <import type="js" file="common/jquery171min" />
    <script type="text/javascript">
        //菜单
        function show_menu(top, url)
        {
            $(".menu li a").removeClass("sel");
            $("#top_menu_" + top).addClass("sel");
            $(".mainer_l dl").hide();
            $(".menu_" + top).show();
            if (url != '')
                $("#main").attr('src', url);
        }
        $(function() {
            $(".menu_{$Think.get.menu}").show();
            $("#top_menu_{$Think.get.menu}").addClass("sel");
        });
        //更新缓存
        function update_cache() {
            $.ajax({
                url: '{:U('update_cache')}?n=' + Math.random(),
                success: function(val)
                {
                    alert(val);
                }
            });
        }
        var minHeight = $(window).height()-220;
            
        function reinitIframe() {
            var iframe = document.getElementById("main");
            var bHeight = iframe.contentWindow.document.body.scrollHeight,
            dHeight = iframe.contentWindow.document.documentElement.scrollHeight,
            height = Math.max(bHeight,dHeight);
            if(height < minHeight)height = minHeight;
            if(height !== iframe.height) {
                iframe.height = height;
            }
        }
        function reinitIframe_init() {
            var iframe = document.getElementById("main");
            iframe.height = minHeight;
            var bHeight = iframe.contentWindow.document.body.scrollHeight,
                dHeight = iframe.contentWindow.document.documentElement.scrollHeight,
                height = Math.max(bHeight, dHeight);
            if (height < minHeight)
                height = minHeight;
            iframe.height = height;
        }
    </script>
</head>
<body>
    <div class="header">
        <div class="w">
            <div class="fl">方维管理系统</div>
            <div class="fr"> <span>你好:{$Think.session.admin_username}</span> | <a href="{:U('/')}" target="_blank">网站首页</a> | <a target="main" href="{:U('changePassword')}" >修改密码</a> | <a href="javascript:update_cache()" >更新缓存</a> | <a href="{:U('Login/logout')}" >退出管理</a> </div>
            <div class="c"> </div>
        </div>
    </div>
    <div class="menu">
        <div class="w">
            <ul>
                <li class="f"><a href="{:U(index)}">后台首页</a></li>
                <foreach name="top_menu" item="item">
                    <li><a id="top_menu_{$item.menu_id}" onClick="show_menu('{$item.menu_id}', '../{$item.menu_link}')" href="javascript:void(0)">{$item.menu_name}</a></li>
                </foreach>
            </ul>
        </div>
    </div>
    <div class="mainer">
        <div class="w"> 
            <div class="mainer_l">
                <foreach name="left_menu" item="item">
                    <dl class="menu_{$item.parent_id}">
                        <dt>{$item.menu_name}</dt>
                        <foreach name="item.sub" item="sitem">
                            <dd><a href="{$sitem.menu_link}" target="{$sitem.target}">{$sitem.menu_name}</a></dd>
                        </foreach>
                    </dl>
                </foreach>
            </div>
            <div class="mainer_r">
                <iframe frameborder="0" name="main" id="main" scrolling="auto" onload="reinitIframe_init()" height="100%" width="100%" src="{$Think.get.url}"></iframe>
                <script type="text/javascript">
                    window.setInterval("reinitIframe()", 300);
                </script>
            </div>
            <div class="c"></div>
        </div>
    </div>
</body>
</html>